# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   selenium_self
# FileName:      read_yaml.py
# Author:       test_liu
# Datetime:     2024/10/17 下午7:41
# Description: 读取yaml文件
# ---------------------------------------------------------------------------
import yaml

from WebTest3.WebTest import log


def read_yaml(yaml_path):
    # 读取yaml文件
    try:
        with open(yaml_path, 'r', encoding='utf-8') as f:
            log.info("读取yaml文件成功")
            return yaml.load(f, Loader=yaml.FullLoader)
    except Exception as e:
        log.error(f"读取yaml文件失败：{e}")
        raise f"读取yaml文件失败：{e}"


if __name__ == '__main__':
    print(read_yaml(r'D:\biancheng\python-project\selenium_self\WebTest2\WebTest\data_config\local_config\loader_data.yaml'))